//
//  HBBankListCell.m
//  HuoBao
//
//  Created by chaiyanan on 15/11/27.
//  Copyright © 2015年 jinxin. All rights reserved.
//

#import "HBBankListCell.h"

@implementation HBBankListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        [self createCustomView];
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}

- (void)createCustomView
{
    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(15, (63-35)/2, 35, 35)];
    self.headImageView.image = [UIImage imageNamed:@"bankImage"];
    
    [self.contentView addSubview:self.headImageView];
    
    self.nameLable = [[UILabel alloc]initWithFrame:CGRectMake(self.headImageView.y+self.headImageView.width+15, 15, SCREEN_WIDTH-(self.headImageView.y+self.headImageView.width+30), 20)];
//    self.nameLable.textColor = [LCCommon getColor:@"333333"];
    self.nameLable.textColor = [LCCommon getColor:@"b1b1b1"];
    self.nameLable.font = [UIFont systemFontOfSize:16.0f];
    self.nameLable.textAlignment = NSTextAlignmentLeft;
    self.nameLable.text = @"工商银行";
    
    [self.contentView addSubview:self.nameLable];
    
    self.desLable = [[UILabel alloc]initWithFrame:CGRectMake(self.headImageView.y+self.headImageView.width+15, 45, SCREEN_WIDTH-(self.headImageView.y+self.headImageView.width+30), 20)];
//    self.desLable.textColor = [LCCommon getColor:@"999999"];
    self.desLable.textColor = [LCCommon getColor:@"777777"];
    self.desLable.font = [UIFont systemFontOfSize:13.0f];
    self.desLable.textAlignment = NSTextAlignmentLeft;
    self.desLable.text = @"单笔限额 20 万 / 单日限额 500 万";
    
    [self.contentView addSubview:self.desLable];
    
    UIView *sepratorLine = [[UIView alloc]initWithFrame:CGRectMake(15, 63, SCREEN_WIDTH-30, 1/([UIScreen mainScreen].scale))];
//    sepratorLine.backgroundColor = [LCCommon getColor:@"dfdfdf"];
    sepratorLine.backgroundColor = [LCCommon getColor:@"585858"];
    [self.contentView addSubview:sepratorLine];
    
}

- (void)reloadViewType
{
    [self.nameLable sizeToFit];
    CGRect frame = self.nameLable.frame;
//    frame.origin = CGPointMake(self.headImageView.y+self.headImageView.width+15, 15);
    frame.origin = CGPointMake(self.headImageView.y+self.headImageView.width+15, 12);
    self.nameLable.frame = frame;
    
    if (self.desLable.text.length>0)
    {
//        NSRange range = [self.desLable.text rangeOfString:@"/"];
//        if (range.location != NSNotFound)
//        {
//            NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:self.desLable.text];
//            [attr addAttribute:NSForegroundColorAttributeName value:[LCCommon getColor:@"e5e5e5"] range:range];
//            self.desLable.attributedText = attr;
//            
//        }
        
        [self.desLable sizeToFit];
        frame = self.desLable.frame;
        frame.origin = CGPointMake(self.headImageView.y+self.headImageView.width+15, self.nameLable.y+self.nameLable.height+8);
        self.desLable.frame = frame;
    }
    
    
    
}

@end
